package com.interagriculture.mapper;

import com.github.pagehelper.Page;
import com.interagriculture.entity.Honor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface HonorMapper {

    /**
     * 荣誉分类查询
     * @param honor
     * @return
     */
    Page<Honor> pageQuery(Honor honor);

    /**
     * 新增一条荣耀关于数据
     * @param honor
     */
    @Insert("insert into honor(title, type, time, winners, bri_info, image) " +
            "values " +
            "(#{title},#{type},#{time},#{winners},#{briInfo},#{image})")
    void insert(Honor honor);

    /**
     * 修改数据
     * @param honor
     */
    @Update("update honor set title = #{title},type = #{type},time = #{time},winners = #{winners}," +
            "bri_info = #{briInfo},image = #{image} where id = #{id}")
    void update(Honor honor);

    /**
     * 荣誉信息的删除
     * @param id
     */
    @Delete("delete from honor where id = #{id}")
    void delete(Integer id);
}
